package com.cx.pull.controller;

import com.cx.pull.service.PullDataService;
import com.cx.pull.vo.QuestionVO;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * PullDataController
 *
 * @author chenXin
 * @date 2024/02/27 15:24
 **/
@Slf4j
@RestController
@RequestMapping("/data")
public class PullDataController {

    @Resource
    private PullDataService pullDataService;

    /**
     * 爬取stackoverflow数据
     *
     * @param pageNum 需要爬取的页数
     * @author: chenXin
     * @date: 2024/2/27
     */
    @GetMapping("/pullQuestions")
    public List<QuestionVO> pullQuestions(Integer pageNum) {
        return pullDataService.pullQuestions(pageNum);
    }

}